<?php
/**
 * ============================================================================
 * Copyright (c) 2015-2018 贵州大师兄信息技术有限公司 All rights reserved.
 * siteַ: http://www.dsxcms.com
 * ============================================================================
 * @author:     David Song<songdewei@163.com>
 * @version:    v1.0.0
 * ---------------------------------------------
 * Date: 2018/8/31
 * Time: 下午4:23
 */

namespace App\Library\Mall;

use App\Models\SellerJPush;

class AppMsgClient
{
    public static function sendNewOrderMessage($seller_uid){
        $registration = SellerJPush::where('uid', $seller_uid)->first();
        if ($registration) {
            if ($registration->ios) {
                selerAppPush()->push()->setPlatform('ios')
                    ->addRegistrationId($registration->ios)
                    ->iosNotification('你有新的订单')
                    ->send();
            }

            if ($registration->android) {
                selerAppPush()->push()->setPlatform('android')
                    ->addRegistrationId($registration->android)
                    ->androidNotification('你有新的订单')
                    ->send();
            }
        }
    }
}
